<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="java.sql.*"%> 
<%@ page import="org.liufeng.course.util.*"%> 
<%@ page language="java" import="java.sql.*,java.net.*,java.util.*,java.text.*,java.io.*,java.net.*" %>
<%@ page import="org.liufeng.course.service.RequestService"%> 
<%@ page import="net.sf.json.*"%> 
<%
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

String url="jdbc:mysql://sqld.duapp.com:4050/ToszmXBSdefwbBRfZIAt";
 String user="Ec2chH8MHnfQo9cUi0ga6jw9";
 String password="tP94jTsaYQCj8XkRw8nb3QmmYAFp4OX0";
 /*
String url="jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8";
String user="root";
String password="niuxiao";
*/
Class.forName("com.mysql.jdbc.Driver");
//获得Connection对象
Connection DBConn = DriverManager.getConnection(url,user,password);
PreparedStatement ps=null;
String id = request.getParameter("id")==null?"":request.getParameter("id").trim();
String sql = "select * from reservoir t where id=? ";
ResultSet rs = null;
String cont = "暂无数据";
String name = "1";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<html>
  <head>
    <base href="<%=basePath%>">
    <title>水库查询</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
	<style>
	ul,li{ margin:0px; padding:0px; list-style:none;}
		.page-aside h1 { color:#404a58; font-size:18px; padding:10px 0px; text-indent:15px; border:1px solid #dfdfe0; border-top:none; border-bottom:none; }
		.page-aside h1.active { color:#fff; }
		.page-aside ul { border:1px solid #dfdfe0; border-top:none; border-bottom:none; }
		.page-aside ul li a{ display:block; color:#6c6d6d; padding:10px 0px; text-indent:15px; background:#fff; border-bottom:1px solid #dfdfe0;  }
		.page-aside ul li a:hover, .page-aside ul li.active a { color:#4482d5; }
	</style>
	<script>
	</script>
  </head>
  <body>
  <div class="page-aside">
    <%
try {
	ps = DBConn.prepareStatement(sql);
	System.out.print(sql);
	ps.setString(1,id);
	rs = ps.executeQuery();
	while(rs.next()){
	String stcd = null ;//测站编码
	String sssw= null; //实时水位
	String sskr= null ;//实时库容
	String jjsw = null;// 警戒水位
	String xsbl = null;// 蓄水比例
	String isWarn= null ;// 是否超出警戒水位
	String sTime = "暂时无数据";//更新时间
	String dispaly = "none";
	String a = "1";
	if(rs.getString("stcd")!=null &&!rs.getString("stcd").equals("null")&&!rs.getString("stcd").equals("")){
		stcd = rs.getString("stcd").trim();
		Map map = RequestService.getSFXX(stcd,"reser");
		a = StrTools.isStrNull(map.get("flag"));
		if(map.get("flag")!=null&&map.get("flag").toString().equals("T")){
		sssw = StrTools.isStrNull(map.get("sssw"));
		sskr = StrTools.isStrNull(map.get("sskr"));
		jjsw = StrTools.isStrNull(map.get("jjsw"));
		xsbl = StrTools.isStrNull(map.get("xsbl"));
		isWarn = StrTools.isStrNull(map.get("isWarn"));
		sTime = StrTools.isStrNull(map.get("sTime"));
		dispaly = "blank";
		
		}
		
	}
		cont="水库名称："+rs.getString("name")+";\r"+
			"所属乡镇："+rs.getString("town")+";\r"+
			"所 在 村："+rs.getString("villageName")+";\r"+
			"总 库 容："+rs.getString("totleCapacity")+" 万m³"+";\r"+
			"正常库容："+rs.getString("nomalCapacity")+" 万m³"+";\r"+
			"水库等级："+rs.getString("flag")+";\r"+
			"最大坝高："+rs.getString("damHight")+" m"+";\r"+
			"坝顶长度："+rs.getString("damDingHight")+" m"+";\r"+
			"坝顶宽度："+rs.getString("damDingWidth")+" m"+";\r"+
			"正常蓄水位："+rs.getString("underHight")+" m";
		name = rs.getString("id").trim();
		
			
%>
<a style='display:none'><%=a %><a>
<h1>水库名称：<%=rs.getString("name") %></h1>
  <ul>
  	<li><a>所属乡镇：<%=StrTools.isStrNull(rs.getString("town")) %></a></li>
  	<li><a>所 在 村：<%=StrTools.isStrNull(rs.getString("villageName")) %></a></li>
  	<li><a>集雨面积：<%=StrTools.isStrNull(rs.getString("square")) %>km²</a></li>
  	<li><a>总 库 容：<%=StrTools.isStrNull(rs.getString("totleCapacity"))%> 万m³ </a></li>
  	<li><a>正常库容：<%=StrTools.isStrNull(rs.getString("nomalCapacity")) %> 万m³</a></li>
  	<li><a>水库等级：<%=StrTools.isStrNull(rs.getString("flag")) %></a></li>
  	<li><a>最大坝高：<%=StrTools.isStrNull(rs.getString("damHight")) %> m</a></li>
  	<li><a>坝顶长度：<%=StrTools.isStrNull(rs.getString("damDingHight")) %> m</a></li>
  	<li><a>坝顶宽度：<%=StrTools.isStrNull(rs.getString("damDingWidth")) %> m</a></li>
  	<li><a>正常水位：<%=StrTools.isStrNull(rs.getString("underHight")) %> m</a></li>
  	<li style='display:<%=dispaly%>'><a>实时水位：<%=sssw%></a></li>
	<li style='display:<%=dispaly%>'><a>实时库容：<%=sskr%></a></li>
	<li style='display:<%=dispaly%>'><a>警戒水位：<%=jjsw %></a></li>
	<li style='display:<%=dispaly%>'><a>蓄水比例：<%=xsbl %></a></li>
	<li style='display:<%=dispaly%>'><a>是否超出警戒水位：<%=isWarn %></a></li>
	<li style='display:<%=dispaly%>'><a>获取时间： <%=sTime %></a></li>
  </ul>
				
<%
	}	
} catch (SQLException e) {
	e.printStackTrace();
}finally {
	DBConn.close();
}
cont = URLEncoder.encode(URLEncoder.encode(new String(cont), "utf-8"),"utf-8");
%>
<a href="<%=basePath%>my.jsp?name=<%=name%>&cont=<%=cont%>" >点击生成二维码</a>
</div>
  </body>
</html>
